<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui">
   
    <ui:composition template="/views/_template.xhtml">
    	<ui:define name="corpo">
            <h:form prependId="false">
                <p:messages id="mensagens" showDetail="true"/>
               
                    <h:outputLabel value="Encerrar conta" style="border-bottom: 3px solid #C22; text-align: left; font-size: 18px; width: 900px;" />
                    <h:dataTable styleClass="dadosForm" style="border: 1px solid #E4E4E4">
                        <h:column>
                        <f:facet name="header">
                            <h:outputLabel style="margin: 5px; text-align: left" for="nConta" value="Nome da conta" />
                        </f:facet>
                        <f:facet name="footer">
                            <p:inputText  style="width: 450px;" value="#{contaBean.conta.nome}"  disabled="true" />
                        </f:facet>
                        </h:column>

                        <h:column>
                            <f:facet name="header">
                                <h:outputLabel style="margin: 5px;text-align: left;" for="da" value="Data de abertura" />
                            </f:facet>
                            <f:facet name="footer" >
                                <p:calendar id="da" pattern="dd/MM/yyyy" value="#{contaBean.conta.dataAbertura.time}" disabled="true" />
                            </f:facet>
                        </h:column>

                        <h:column>
                            <f:facet name="header">  
                                <h:outputLabel style="margin: 5px; text-align: left; width: 150px;" for="de" value="Data de encerramento" />
                                <f:facet name="footer">
                                    <p:calendar id="de" pattern="dd/MM/yyyy" value="#{contaBean.conta.dataEncerramento.time}" />
                                </f:facet>
                            </f:facet>
                        </h:column>

                    </h:dataTable>

                    <h:dataTable styleClass="dadosForm" style="border: 1px solid #E4E4E4">
                        <h:column>
                            <f:facet name="header">
                                <h:outputLabel style="margin: 5px; text-align: left"  value="Numero conta" for="nConta" />
                            </f:facet>
                            <f:facet name="footer">
                                <p:inputText id="nConta" style="width: 127px;" value="#{contaBean.conta.numero}" disabled="true" />
                            </f:facet>
                        </h:column>
                        <h:column>
                            <f:facet name="header">
                                <h:outputLabel style="margin: 5px; text-align: left;" value="Gerente" for="gerente" />
                            </f:facet>
                            <f:facet name="footer">
                                <p:inputText style="width: 450px;" id="gerente" value="#{contaBean.conta.gerente}" disabled="true" />
                            </f:facet>
                        </h:column>
                        <h:column>
                            <f:facet name="header">
                                <h:outputLabel style="margin: 5px; text-align: left;" value="Saldo" for="saldo" />
                            </f:facet>
                            <f:facet name="footer">
                                <p:inputText style="width: 200px;" id="saldo" value="#{contaBean.conta.saldo}" styleClass="moeda" disabled="true" >
                                    <f:convertNumber minFractionDigits="2" maxFractionDigits="2" locale="pt_BR"  />
                                </p:inputText>
                            </f:facet>
                        </h:column>
                    </h:dataTable>

                    <h:dataTable styleClass="dadosForm" style="border: 1px solid #E4E4E4">
                        <h:column>
                            <f:facet name="header">
                                <h:outputLabel style="margin: 5px; text-align: left;" value="Nome do banco"  />
                            </f:facet>
                            <f:facet name="footer">
                                <f:facet name="footer">
                                    <p:selectOneMenu value="#{contaBean.conta.banco}" 
                                                     converter="entityConverter" style="padding-left: 2px; width: 200px;" disabled="true">
                                        <f:selectItem itemLabel="Selecione um banco" itemValue="" noSelectionOption="true" />
                                        <f:selectItems value="#{bancoBean.bancos}" var="banco" itemLabel="#{banco.nomeBanco}" />
                                    </p:selectOneMenu>
                                </f:facet>
                            </f:facet>
                        </h:column>
                    </h:dataTable> 
                    
                    <p:commandButton id="showDialogButton" value="Encerrar" onclick="confirmacao.show()" type="button" />
                    <p:confirmDialog id="confirmDialog" message="Confirma o encerramento da conta?" header="Atenção" widgetVar="confirmacao" appendToBody="true" >
                        <p:commandButton id="confirma" value="Sim" update="mensagens" oncomplete="confirmacao.hide()" actionListener="#{contaBean.confirmaEncerrarConta}" />
                        <p:commandButton id="cancela" value="Cancelar" onclick="confirmacao.hide()" type="button"/>
                    </p:confirmDialog>     
            </h:form>         
        </ui:define>
    </ui:composition>
</html>

